home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / DTS QT Utilities.Aug-95 / Projects & Test Apps / MovieShell / Mac Framework / MacFramework.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-11  |  3.5 KB  |  139 lines  |  [TEXT/MPCC]

  1. /*
  2.     File:        MacFramework.h
  3.  
  4.     Contains:    Basic Macintosh Functions for Window, Menu handling and similar things.
  5.  
  6.     Written by:    DTS
  7.  
  8.     Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.        <1>         12/20/94    khs        first file
  13.        
  14. */
  15.  
  16.  
  17. #pragma once
  18.  
  19.  
  20. // INCLUDES
  21. #include <Movies.h>
  22. #include <stdio.h>
  23. #include <TextUtils.h>
  24. #include <Memory.h>
  25.  
  26. #ifdef __MWERKS__
  27. #include <sioux.h>
  28. #endif // __MWERKS__
  29.  
  30.  
  31. // ENUMS, DEFINES AND GLOBALS
  32. enum         {  kMovieControllerObject  = 'MCOb'
  33.              };
  34.  
  35.  
  36.  
  37. // MACROS
  38. //#if DEBUG
  39. //static char gAppDebugString[256];
  40. //
  41. //#define DebugAssert(condition)                                                        \
  42. //        if (condition)        NULL;                                                            \
  43. //    else                                                                                             \
  44. //    {                                                                                                \
  45. //        sprintf(gAppDebugString,"File: %s, Line: %d", __FILE__, __LINE__);            \
  46. //        DebugStr(c2pstr(gAppDebugString));                                            \
  47. //    }
  48. //#else
  49. //#define DebugAssert(condition)        NULL
  50. // #endif
  51.  
  52.  
  53. // ENUMS 
  54. // MENUS
  55. enum eMenubar { mMenubar = 128};
  56.  
  57. enum eMainMenus {
  58.     mApple = 128, mFile, mEdit
  59. };
  60.  
  61. enum  eAppleMenu {
  62.     iAbout = 1
  63. };
  64.  
  65. enum   eFileMenu{
  66.     iNew = 1, iOpen, iClose, iSave, iSaveAs, iPrint =7, iQuit = 9
  67. };
  68.  
  69. enum eEditMenu {
  70.     iUndo = 1, iCut = 3, iCopy, iPaste, iClear, iSelectAll = 8
  71. };
  72.  
  73. // DIALOGS
  74. enum eDialogs {
  75.     kAboutBox = 128, kAlertError = 129
  76. };
  77.  
  78.  
  79. // TYPEDEFS AND STRUCTURES
  80. // WindowObjectRecord/Ptr is a data structure attached to the movie window. Use
  81. // this structure if you want to associate any data with any window presented.
  82.  
  83. typedef struct {
  84.     OSType                    ObjectType;                        // specific tag indicating that the window object belongs to our application
  85.     MovieController     controller;
  86.     Rect                        originalSize;                    // including movie controller
  87.     FSSpec                    FileFSSpec;
  88.     short                    FileResID;
  89.     short                    FileRefNum;
  90.     
  91. // add more elements if needed
  92. } WindowObjectRecord, *WindowObjectPtr, **WindowObject;
  93.  
  94.  
  95. // FUNCTION PROTOTYPES
  96.  
  97. // PURE MAC TOOLBOX FUNCTIONS
  98. void                        InitStack(long extraStackSpace);
  99. void                         InitMacEnvironment(long nMoreMasters);
  100. pascal void             AppGrowZoneCallback(void);
  101.  
  102. Boolean                 InitMenubar(void);
  103. void                         HandleMenuCommand(long theMenuResult);
  104. void                         AdjustMenus(void);
  105. void                         MainEventLoop(void);
  106.  
  107. Boolean                 IsAppWindow(WindowRef theWindow);
  108. WindowObject         CreateWindowObject(WindowRef theWindow);
  109.  
  110. void                         HandleKeyPress(EventRecord *theEvent);
  111. void                         ShowAboutDialogBox(void);
  112. void                         ShowWarning(Str255 theMessage, OSErr theErr);
  113.  
  114. // MOVIE RELATED TOOLBOX FUNCTIONS
  115. MovieController      GetMCFromFrontWindow(void);
  116. Boolean                 IsWindowObjectOurs(WindowObject theObject);
  117. Boolean                 DoCreateNewMovie(void);
  118. MovieController    SetupMovieWindowWithController(Movie theMovie, WindowRef theWindow);
  119. Boolean                 DoCreateMovieWindow(Movie theMovie);
  120. void                         DoDestroyMovieWindow(WindowRef theWindow);
  121. void                         DoActivateWindow(WindowRef theWindow, Boolean becomingActive);
  122. Boolean                 DoUpdateMovieFile(WindowRef theWindow);
  123.  
  124.  
  125. // APPLICATION SPECIFIC FUNCTIONS
  126. // These are placed in the MacApplication.c file, you could override these for changing
  127. // the behavior of the function in a specific application.
  128.  
  129. void                        DoIdle(WindowRef theWindow);
  130. void                        DoUpdateWindow(WindowRef theWindow, Rect *theRefrehArea);
  131. void                         HandleContentClick(WindowRef theWindow, EventRecord *theEvent);
  132. WindowRef             CreateMovieWindow(Rect *theRect, Str255 theTitle);
  133. void                        AddControllerFunctionality(MovieController mc);
  134. void                         HandleApplicationMenu(short theMenuID, short theMenuItem);
  135. void                        AdjustApplicationMenus(void);
  136.  
  137.  
  138.  
  139.